<?php

namespace Part15_AbstractFactoryPattern\Code5;

class DataAccess
{
    // 写死在此处或者读取配置项
    private static $db = 'Mysql';

    public static function createUser()
    {
        $className = 'Part15_AbstractFactoryPattern\\Code5\\' . self::$db . 'User';
        return (new \ReflectionClass($className))->newInstance();
    }

    public static function createDepartment()
    {
        $className = 'Part15_AbstractFactoryPattern\\Code5\\' . self::$db . 'Department';
        return (new \ReflectionClass($className))->newInstance();
    }
}